﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:sys="clr-namespace:System;assembly=mscorlib">
    
    

    <!-- ToolTip -->
    <ControlTemplate x:Key="ValidationToolTipTemplate">
        <Grid x:Name="Root" Margin="5,0" RenderTransformOrigin="0,0" Opacity="0">
            <Grid.RenderTransform>
                <TranslateTransform x:Name="xform" X="-25"/>
            </Grid.RenderTransform>
            <vsm:VisualStateManager.VisualStateGroups>
                <vsm:VisualStateGroup Name="OpenStates">
                    <vsm:VisualStateGroup.Transitions>
                        <vsm:VisualTransition GeneratedDuration="0"/>
                        <vsm:VisualTransition To="Open" GeneratedDuration="0:0:0.2">
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="xform" Storyboard.TargetProperty="X" To="0" Duration="0:0:0.2">
                                    <DoubleAnimation.EasingFunction>
                                        <BackEase Amplitude=".3" EasingMode="EaseOut"/>
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>
                                <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"/>
                            </Storyboard>
                        </vsm:VisualTransition>
                    </vsm:VisualStateGroup.Transitions>
                    <vsm:VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/>
                        </Storyboard>
                    </vsm:VisualState>
                    <vsm:VisualState x:Name="Open">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="xform" Storyboard.TargetProperty="X" To="0" Duration="0"/>
                            <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                        </Storyboard>
                    </vsm:VisualState>
                </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>

            <Border Margin="4,4,-4,-4" Background="#052A2E31" CornerRadius="5"/>
            <Border Margin="3,3,-3,-3" Background="#152A2E31" CornerRadius="4"/>
            <Border Margin="2,2,-2,-2" Background="#252A2E31" CornerRadius="3"/>
            <Border Margin="1,1,-1,-1" Background="#352A2E31" CornerRadius="2"/>

            <Border Background="#FFDC000C" CornerRadius="2"/>
            <Border CornerRadius="2">
                <TextBlock 
              UseLayoutRounding="false" 
              Foreground="White" Margin="8,4,8,4" MaxWidth="250" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}"/>
            </Border>
        </Grid>
    </ControlTemplate>

    <!-- Grad Fill-->
    <Path x:Key="LabelBG" Stretch="Fill" Data="M1.5,98.5L328.5,98.5L328.5,79.5L1.5,79.5z" UseLayoutRounding="False">
        <Path.Fill>
            <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                <GradientStop Color="#FF57585A" Offset="0"/>
                <GradientStop Color="#FF221E1F" Offset="1"/>
            </LinearGradientBrush>
        </Path.Fill>
    </Path>

    <!-- Point Feed Checkbox -->
    <Style TargetType="CheckBox" x:Key="PointFeedCheckBox">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Padding" Value="4,1,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <Grid VerticalAlignment="Center" Height="25">
                        <Grid.Background>
                            <ImageBrush ImageSource="Images/list_item.png" Stretch="Fill"/>
                        </Grid.Background>

                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HoverImageBG" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:0.25" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed"/>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To=".55"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="CheckStates">
                                <vsm:VisualState x:Name="Checked">
                                    <Storyboard>

                                        <DoubleAnimation Storyboard.TargetName="SelectedImageBG" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:0.25" To="1"/>
                                        <DoubleAnimation Storyboard.TargetName="CheckedBox" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:0.25" To="1"/>

                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unchecked"/>
                                <vsm:VisualState x:Name="Indeterminate"/>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused"/>
                                <vsm:VisualState x:Name="Unfocused" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="Valid"/>
                                <vsm:VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" >
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" >
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0" >
                                                <DiscreteObjectKeyFrame.Value>
                                                    <sys:Boolean>True</sys:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>



                        <Image x:Name="SelectedImageBG" Source="Images/list_item_selected.png" Opacity="0" Height="25" Stretch="Fill"/>

                        <Image x:Name="HoverImageBG" Source="Images/list_item_hover.png" Opacity="0" Height="25" Stretch="Fill"/>

                        <!-- Content Grid -->
                        <Grid>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="24"/>
                                <ColumnDefinition Width="24"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Grid Width="16" Height="16" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <Image x:Name="UnCheckedBox" Source="Images/checkbox.png" Width="16" Height="14" Stretch="None"/>
                                <Image x:Name="CheckedBox" Source="Images/checkbox_selected.png" Opacity="0" Width="16" Height="14" Stretch="None"/>
                            </Grid>


                            <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2"  Width="16" Height="16" Grid.Column="0">
                                <Border x:Name="ValidationErrorElement" Margin="1" BorderThickness="1" CornerRadius="1" BorderBrush="#FFDB000C" Visibility="Collapsed"
                              ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                    <ToolTipService.ToolTip>
                                        <ToolTip x:Name="validationTooltip" 
                                   Template="{StaticResource ValidationToolTipTemplate}"
                                   DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                   Placement="Right" 
                                   PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                            <ToolTip.Triggers>
                                                <EventTrigger RoutedEvent="Canvas.Loaded">
                                                    <EventTrigger.Actions>
                                                        <BeginStoryboard>
                                                            <Storyboard>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" >
                                                                        <DiscreteObjectKeyFrame.Value>
                                                                            <sys:Boolean>true</sys:Boolean>
                                                                        </DiscreteObjectKeyFrame.Value>
                                                                    </DiscreteObjectKeyFrame>
                                                                </ObjectAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </BeginStoryboard>
                                                    </EventTrigger.Actions>
                                                </EventTrigger>
                                            </ToolTip.Triggers>
                                        </ToolTip>
                                    </ToolTipService.ToolTip>
                                    <Grid Width="10" Height="10" HorizontalAlignment="Right" Margin="0,-4,-4,0" VerticalAlignment="Top" Background="Transparent">
                                        <Path Margin="0,3,0,0" Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#FFDC000C"/>
                                        <Path Margin="0,3,0,0" Data="M 0,0 L2,0 L 7,5 L7,7" Fill="#ffffff"/>
                                    </Grid>
                                </Border>
                            </Grid>

                            <Image Source="{Binding Icon}" Width="22" Height="22" Margin="2" Grid.Column="1" />

                            <TextBlock x:Name="contentPresenter" 
                                   Text="{Binding Title}" 
                                   Grid.Column="2"
                                   Margin="2"
                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                   />
                        </Grid>
                        <!-- End Content Grid -->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- RegionFeedRadioButton -->
    <Style TargetType="RadioButton" x:Key="RegionFeedRadioButton">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Padding" Value="4,1,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RadioButton">
                    <Grid VerticalAlignment="Center" Height="25">
                        <Grid.Background>
                            <ImageBrush ImageSource="Images/list_item.png" Stretch="Fill"/>
                        </Grid.Background>

                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>


                                        <DoubleAnimation Storyboard.TargetName="HoverImageBG" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:0.25" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed"/>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To=".55"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="CheckStates">
                                <vsm:VisualState x:Name="Checked">
                                    <Storyboard>

                                        <DoubleAnimation Storyboard.TargetName="SelectedImageBG" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:0.25" To="1"/>
                                        <DoubleAnimation Storyboard.TargetName="CheckedBox" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0:0:0.25" To="1"/>

                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unchecked"/>
                                <vsm:VisualState x:Name="Indeterminate"/>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused"/>
                                <vsm:VisualState x:Name="Unfocused" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="Valid"/>
                                <vsm:VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" >
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" >
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0" >
                                                <DiscreteObjectKeyFrame.Value>
                                                    <sys:Boolean>True</sys:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>



                        <Image x:Name="SelectedImageBG" Source="Images/list_item_selected.png" Opacity="0" Height="25" Stretch="Fill"/>

                        <Image x:Name="HoverImageBG" Source="Images/list_item_hover.png" Opacity="0" Height="25" Stretch="Fill"/>

                        <!-- Content Grid -->
                        <Grid>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="24"/>
                                <!--<ColumnDefinition Width="24"/>-->
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Grid Width="16" Height="16" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <Image x:Name="UnCheckedBox" Source="Images/radio.png" Width="16" Height="14" Stretch="None"/>
                                <Image x:Name="CheckedBox" Source="Images/radio_selected.png" Opacity="0" Width="16" Height="14" Stretch="None"/>
                            </Grid>


                            <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2"  Width="16" Height="16" Grid.Column="0">
                                <Border x:Name="ValidationErrorElement" Margin="1" BorderThickness="1" CornerRadius="1" BorderBrush="#FFDB000C" Visibility="Collapsed"
                              ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                    <ToolTipService.ToolTip>
                                        <ToolTip x:Name="validationTooltip" 
                                   Template="{StaticResource ValidationToolTipTemplate}"
                                   DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                   Placement="Right" 
                                   PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                            <ToolTip.Triggers>
                                                <EventTrigger RoutedEvent="Canvas.Loaded">
                                                    <EventTrigger.Actions>
                                                        <BeginStoryboard>
                                                            <Storyboard>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" >
                                                                        <DiscreteObjectKeyFrame.Value>
                                                                            <sys:Boolean>true</sys:Boolean>
                                                                        </DiscreteObjectKeyFrame.Value>
                                                                    </DiscreteObjectKeyFrame>
                                                                </ObjectAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </BeginStoryboard>
                                                    </EventTrigger.Actions>
                                                </EventTrigger>
                                            </ToolTip.Triggers>
                                        </ToolTip>
                                    </ToolTipService.ToolTip>
                                    <Grid Width="10" Height="10" HorizontalAlignment="Right" Margin="0,-4,-4,0" VerticalAlignment="Top" Background="Transparent">
                                        <Path Margin="0,3,0,0" Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#FFDC000C"/>
                                        <Path Margin="0,3,0,0" Data="M 0,0 L2,0 L 7,5 L7,7" Fill="#ffffff"/>
                                    </Grid>
                                </Border>
                            </Grid>

                            <TextBlock x:Name="contentPresenter" 
                                   Text="{Binding Title}" 
                                   Grid.Column="1"
                                   Margin="2"
                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                   />
                        </Grid>
                        <!-- End Content Grid -->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DefaultButton -->
    <Style TargetType="Button" x:Key="DefaultButton">
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.5" Storyboard.TargetName="BorderBrush"
                                            Storyboard.TargetProperty="Opacity" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ButtonPressedImg"
                                            Storyboard.TargetProperty="Opacity" To="0" />
                                    </Storyboard>

                                </VisualState>
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.5" Storyboard.TargetName="BorderBrush"
                                            Storyboard.TargetProperty="Opacity" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ButtonPressedImg"
                                            Storyboard.TargetProperty="Opacity" To="0" />
                                    </Storyboard>

                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="BorderBrush"
                                            Storyboard.TargetProperty="Opacity" To="0" />
                                        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="ButtonPressedImg"
                                            Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>

                                </VisualState>
                            </VisualStateGroup>
                            <!--<VisualStateGroup x:Name="FocusStates">
                                
                                
                            </VisualStateGroup>-->

                        </VisualStateManager.VisualStateGroups>

                        <Border x:Name="RootElement">
                            <Border.Background>
                                <ImageBrush x:Name="BorderBackground" Opacity="1" ImageSource="Images/button.png"/>
                            </Border.Background>

                            <Grid Margin="0">
                                <Grid.Background>
                                    <ImageBrush x:Name="BorderBrush" Opacity="0" ImageSource="Images/button_hover.png"/>
                                </Grid.Background>

                                <Image x:Name="ButtonPressedImg"  Source="Images/button_pressed.png" Stretch="None" Opacity="0"></Image>

                                <ContentPresenter
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Margin="4,5,4,4" />


                            </Grid>

                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DropShadow Effect -->
    <DropShadowEffect x:Key="PointDataDropShadow" BlurRadius="8" ShadowDepth="0" Color="Black" Opacity="1.0"></DropShadowEffect>

    
    
</ResourceDictionary>
